using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Globalization;
using System.Windows.Forms;

namespace Pbdms.Views
{
    public partial class FrmProgress : Form
    {
        private System.Threading.Thread objThread ;
        public FrmProgress()
        {
            InitializeComponent();
        }
        public void Show_Progress(ref System.Threading.Thread mThread, string sDescription)
         {
         try {
             
             objThread = mThread;
             
             DateTimeFormatInfo myDateformat = new DateTimeFormatInfo();
             myDateformat.ShortDatePattern = "dd/MM/yyyy";
             objThread.CurrentCulture = new CultureInfo("en-US");
             objThread.CurrentCulture.DateTimeFormat = myDateformat;
                 
             this.lbDescription.Text = sDescription;
             Timer_Event.Enabled = true;
             objThread.Start();
             this.ShowDialog();

         }        
         catch (Exception ex) {             
             throw ex;
         }
         finally {
             Timer_Event.Enabled = false;
             this.Hide();             
         }
     }
    
     public string TextDescription {
         get { return this.lbDescription.Text; }
         set { this.lbDescription.Text = value; }
     }
    
     public int SpinSpeed {
         get { return this.spProgress.AutoIncrementFrequency; }
         set { this.spProgress.AutoIncrementFrequency = value; }
     }
    
     private void Timer_Event_Tick(object sender, System.EventArgs e)
     {
         if ((objThread.ThreadState == System.Threading.ThreadState.Aborted | objThread.ThreadState == System.Threading.ThreadState.Stopped)) {
             this.Hide();
         }
         else {
             //Application.DoEvents()
         }
     }

       
    }
}